import { defineStore } from 'pinia'

export interface SettingSate {
  schemeMode: 'System' | 'Light' | 'Dark'
}
const settingStore = defineStore('SettingStore', {
  state: (): SettingSate => ({
    schemeMode: 'Light',
  }),
  getters: {
    prefersColorScheme(state) {
      if (state.schemeMode === 'System') {
        return 'Light'
      }
      return state.schemeMode
    },
  },
  actions: {
    setColorScheme(mode: Pick<SettingSate, 'schemeMode'>['schemeMode']) {
      this.$state.schemeMode = mode
    },
  },
})

export default settingStore
